Hi all,
I need some help making a menu program that will, when I enter a certain number, open the program assigned to it. For example if I type the number 1 and hit Enter, then it'll open the program Example.exe which is in the same folder as the menu program.
I've tried making it already, but it didn't open the program. It just gave the program a size of 0 KB (I looked in the map that Example.exe is in and saw that at the ofstream command it made the file 0 KB and let it become useless (luckily I had it backed up, so no worries about that).
Here's the code I used for that:
Code:
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
int Difficulity;
cout << "This is a program to choose between the difficulities created" << endl;
cout << "for my ApplePuzzle program" << endl;
cout << "Untill now, you can only choose Easy (type 1 for that)" << endl;
cin >> Difficulity;
cin.ignore();
switch ( Difficulity ) {
case 1:
ofstream a_file ( "ApplePuzzle Easy v1,1.exe" );
return 0;
}
return 0;
}
Also I'd like to know how to get it to do something else when I put in something different than 1.
I really hope someone can help me.
Code:
#include iostream
using namespace std;
int main() {
int UseFullComments;
if ( UseFullComments > 0 ) {
cout << "Bartvo is Happy" << endl;
}
else {
cout << "Bartvo isn't Happy..." << endl;
}
cin.get()
return 0;
}